﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using NetDiskPRJ.DBUtility;

namespace NetDiskPRJ.DAL
{
    public class Apscattbl
    {
        public Apscattbl()
        {
 
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<Model.Apscattbl> DataTableToList(DataTable dt)
        {
            List<Model.Apscattbl> modelList = new List<Model.Apscattbl>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                Model.Apscattbl model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Model.Apscattbl();
                    if (dt.Rows[n]["aps_tnam"] != null && dt.Rows[n]["aps_tnam"].ToString() != "")
                    {
                        model.aps_tnam = dt.Rows[n]["aps_tnam"].ToString();
                    }
                    if (dt.Rows[n]["aps_cmnt"] != null && dt.Rows[n]["aps_cmnt"].ToString() != "")
                    {
                        model.aps_cmnt = dt.Rows[n]["aps_cmnt"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        ///<creator>zhongyl</creator>
        /// <date>2012-02-21</date>
        /// </summary>
        public List<Model.Apscattbl> GetList()
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select aps_tnam,aps_cmnt ");
            strSql.Append(" FROM apscattbl ");
            return DataTableToList(DbHelperSQL.Query(strSql.ToString()).Tables[0]);
        }
    }
}
